<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet"
	type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>商家对账</title>
<style>
.title {
	display: block;
	background: #5a98de;
	line-height: 31px;
	float: left;
	color: white;
	width: 95px;
	text-align: center;
}

.title:hover {
	text-decoration: none;
	color: white;
}
</style>
</head>
<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 商家中心 <span class="c-gray en">&gt;</span> 商家对账 

		<a class="btn btn-success btn-refresh radius r mr-20"
			style="line-height:1.6em;margin-top:3px"
			onclick="javascript:location.replace(location.href);"
			href="javascript:location.replace(location.href);" title="刷新">刷新</a>
	</nav>
	<div class="pd-20">
		<div class="cl pd-5 bg-1 bk-gray" style="margin-top:20px;">

			<form action="<%=path%>/backstage/stats-list" method="post"
				class="form form-horizontal" id="form-goods-add">
				<div class="text-c">
				<div class="row cl">
					<label class="form-label col-1">店铺名：</label>
					<div class="formControls col-2">
						<input type="text" value="${shopname }" name="shopname" id="" placeholder="店铺名" class="input-text">
					</div>
					<label class="form-label col-1">结款方式：</label>
					<div class="formControls col-2">
						<span class="select-box"> <select name="balance"
							class="select">
								<option value="">默认</option>
								<option <c:if test="${balance=='预付' }">selected</c:if>  value="预付">预付</option>
								<option <c:if test="${balance=='现结算' }">selected</c:if> value="现结算">现结算</option>
								<option <c:if test="${balance=='周结算' }">selected</c:if>  value="周结算">周结算</option>
								<option <c:if test="${balance=='月结算' }">selected</c:if>  value="月结算">月结算</option>
						</select>
						</span>
					</div>
					<label class="form-label col-1">所属县市：</label>
					<div class="formControls col-2"> 
						<span class="select-box">
							<select class="select" name="cityid" id="">
								<option value="">--全部--</option>
								<c:forEach items="${citys}" var="city">
									<option value="${city.id}" <c:if test="${city.id==cityid}">selected</c:if> >${city.name}</option>
								</c:forEach>
							</select>
						</span>
		   			</div>
					<label class="form-label col-1">佣金比例：</label>
					<div class="formControls col-2">
						<input type="text" value="${discount }" name="discount" id="" placeholder="佣金比例" class="input-text">
					</div>
					<%-- <label class="form-label col-1">结算日期：</label>
					<div class="formControls col-2">
						<input type="text"  name="stime"  onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'datemax\')}'})"  value="${stime}"  id="datemin" class="input-text Wdate">
					</div>
					<div class="formControls col-2">
						<input type="text" name="etime" value="${etime}" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'datemin\')}'})" id="datemax" class="input-text Wdate">
					</div> --%>
					</div>
					</div>
					<div class="text-c">
					<div class="row cl">
					<%-- <label class="form-label col-1">佣金比例：</label>
					<div class="formControls col-2">
						<input type="text" value="${discount }" name="discount" id="" placeholder="佣金比例" class="input-text">
					</div> --%>
					</div>
					</div>
					<div class="row cl">
					<button name="" id="" class="btn btn-success" style="border-radius:5px;float:right;" type="submit">
						 查询
					</button>
					<div style="width:10px;height:5px;float:right;"></div>
					<button name="" id="" class="btn btn-success" style="border-radius:5px;float:right;" type="reset">
						 重置
					</button>
					</div>
				</div>
			</form>

		</div>

		<div class="mt-20">
			<table
				class="table table-border table-bordered table-hover table-bg table-sort">
				<thead>
					<tr class="text-c">
						<th>商家名称</th>
						<th>商家结算方式</th>
						<th>佣金比例(%)</th>
						<th>订单总额(元)</th>
						<th>订单总额(元)(未结算)</th>
						<th>商家收入(元)(扣除佣金后)</th>
						<th>应结款总额(未结算部分)</th>
						<th>预付款当前余额</th>
						<th width="120">操作</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${stats}" var="stat">
						<tr class="text-c">
							<input type="hidden" id="cId" name="cId" value='${stat.shopid}' />
							<td>${stat.c_sname}</td>
							<td>${stat.js }</td>
							<td>${stat.discount }</td>
							<td>${stat.orders_money}</td>
							<td>${stat.wjs }</td>
							<td>${stat.fg }</td>
							<td>${stat.yjs }</td>
							<td>${stat.pre_payment }</td>
							<td class="td-manage"><a style="text-decoration:none"
								onClick="shop_del('${stat.shopid}')" href="javascript:;"
								title="查看详情">查看详情</a>
							</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
		<input type="hidden" id="shopid">
	</div>
	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
	<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript"
		src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="js/H-ui.js"></script>
	<script type="text/javascript" src="js/H-ui.admin.js"></script>
	<script type="text/javascript">
		$(function() {
			$('.table-sort').dataTable({
				"aaSorting" : [ [ 3, "desc" ] ],//默认第几个排序
				"bStateSave" : true,//状态保存
				"aoColumnDefs" : [
				//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
				{
					"orderable" : false,
					"aTargets" : [ 0,1,8 ]
				} // 制定列不参与排序
				]
			});
			$('.table-sort tbody').on('click', 'tr', function() {
				if ($(this).hasClass('selected')) {
					$(this).removeClass('selected');
				} else {
					table.$('tr.selected').removeClass('selected');
					$(this).addClass('selected');
				}
			});
		});
		
		/*添加*/
		function shop_add(title,url){
			var index = layer.open({
				type: 2,
				title: title,
				content: url
			});
			layer.full(index);
		}
		/*编辑*/
		function shop_edit(obj,id,w,h){
			var edit_page = "<%=path%>/backstage/shop-add-pre?id="+id;
			var index = layer.open({
				type: 2,
				title: "编辑",
				content: edit_page
			});
			layer.full(index);
		}
		/*查看*/
		function shop_del(id){
			$("#shopid").val(id);
			var edit_page = "<%=path%>/backstage/shopOrderDel?shopid="+id;
			var index = layer.open({
				type: 2,
				title: "查看",
				content: edit_page
			});
			layer.full(index);
		}
		/*审核*/
		function shop_enable(obj,id){
			layer.confirm('审核商户?', {
				btn: ['通过','不通过'], 
				shade: false
			},function(){
				$.ajax({
					type : "POST",
					url : "<%=path%>/backstage/shop-enable",
					data : "c_id=" + id,
					error : function() {
						layer.msg('操作失败', {
							icon : 5,
							time : 1000
						});
					},
					success : function(msg) {
						$(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已审核</span>');
						$(obj).remove();
						layer.msg('已审核', {
							icon : 6,
							time : 1000
						});
					}
				});
				}, function() {
					layer.msg('未通过', {
					icon : 5,
					time : 1000
				});
		});
		}
		if($("#status").val()==1){
			$("#all").css({"background":"#5a98de","border":"1px solid #5a98de"});
			$("#enable").css({"background":"white","border":"1px solid black","color":"black"});
		}else if($("#status").val()==0){
			$("#enable").css({"background":"#5a98de","border":"1px solid #5a98de"});
			$("#all").css({"background":"white","border":"1px solid black","color":"black"});
		}else{
			$("#all").css({"background":"#5a98de","border":"1px solid #5a98de"});
			$("#enable").css({"background":"white","border":"1px solid black","color":"black"});
		}
		//$("#enable").css({"background":"#429842"});
		
		//选择店铺状态
		$("#all").click(function(){
			$("#status").val(1);
			$("#form-goods-add").submit();
			$("#all").css({"background":"#5a98de","border":"1px solid #5a98de"});
			$("#enable").css({"background":"white","border":"1px solid black","color":"black"});
		});
		
		//选择店铺状态
		$("#enable").click(function(){
			$("#status").val(0);
			$("#form-goods-add").submit();
			$("#enable").css({"background":"#5a98de","border":"1px solid #5a98de"});
			$("#all").css({"background":"white","border":"1px solid black","color":"black"});
		});

		/*图片-下架*/
		function product_stop(obj, id) {
			layer.confirm('确认要下架吗？',
				function(index) {
				$(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="product_start(this,id)" href="javascript:;" title="发布"><i class="Hui-iconfont">&#xe603;</i></a>');
				$(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已下架</span>');
				$(obj).remove();
				layer.msg('已下架!', {
					icon : 5,
					time : 1000
				});
			});
		}
	</script>
</body>
</html>